using System;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace WcfService1.DTO
{
    [DataContract]
    public class ItemDTO : INotifyPropertyChanged
    {
        private CoaDTO _CoaHpp;
        private CoaDTO _CoaInventory;
        private String _Description;
        private bool _IsRounded;
        private bool _IsStock;
        private String _ItemId;


        private String _ItemName;
        private int _No;
        private Int32 _SaldoAwal;
        private SatuanDTO _Satuan;
        private SatuanDTO _SatuanPack;
        private SubGroupDTO _SubGroup;
        private String _created_by;
        private DateTime? _created_date;
        private String _modified_by;
        private DateTime? _modified_date;
        private bool _isSelected;
        private ItemDTO _CoaUnbilled;
        private CoaDTO _CoaPurchaseReturn;
        private CoaDTO _CoaExpense;
        private CoaDTO _CoaSales;
        private ItemDTO _CoaInTransit;
        private CoaDTO _CoaSalesReturn;

        [DataMember]
        public String ItemId
        {
            get { return _ItemId; }
            set
            {
                _ItemId = value;
                RaisePropertyChanged("ItemId");
            }
        }

        [DataMember]
        public String ItemName
        {
            get { return _ItemName; }
            set
            {
                _ItemName = value;
                RaisePropertyChanged("ItemName");
            }
        }


        [DataMember]
        public String Description
        {
            get { return _Description; }
            set
            {
                _Description = value;
                RaisePropertyChanged("Description");
            }
        }


        [DataMember]
        public SubGroupDTO SubGroup
        {
            get { return _SubGroup; }
            set
            {
                _SubGroup = value;
                RaisePropertyChanged("SubGroup");
            }
        }


        [DataMember]
        public String created_by
        {
            get { return _created_by; }
            set
            {
                _created_by = value;
                RaisePropertyChanged("created_by");
            }
        }


        [DataMember]
        public DateTime? created_date
        {
            get { return _created_date; }
            set
            {
                _created_date = value;
                RaisePropertyChanged("created_date");
            }
        }

        [DataMember]
        public String modified_by
        {
            get { return _modified_by; }
            set
            {
                _modified_by = value;
                RaisePropertyChanged("modified_by");
            }
        }


        [DataMember]
        public DateTime? modified_date
        {
            get { return _modified_date; }
            set
            {
                _modified_date = value;
                RaisePropertyChanged("modified_date");
            }
        }

        [DataMember]
        public Int32 SaldoAwal
        {
            get { return _SaldoAwal; }
            set
            {
                _SaldoAwal = value;
                RaisePropertyChanged("SaldoAwal");
            }
        }


        [DataMember]
        public SatuanDTO Satuan
        {
            get { return _Satuan; }
            set
            {
                _Satuan = value;
                RaisePropertyChanged("Satuan");
            }
        }


        [DataMember]
        public CoaDTO CoaHpp
        {
            get { return _CoaHpp; }
            set
            {
                _CoaHpp = value;
                RaisePropertyChanged("CoaHpp");
            }
        }


        [DataMember]
        public CoaDTO CoaInventory
        {
            get { return _CoaInventory; }
            set
            {
                _CoaInventory = value;
                RaisePropertyChanged("CoaInventory");
            }
        }

        [DataMember]
        public bool IsStock
        {
            get { return _IsStock; }
            set
            {
                _IsStock = value;
                RaisePropertyChanged("IsStock");
            }
        }

        [DataMember]
        public bool IsRounded
        {
            get { return _IsRounded; }
            set
            {
                _IsRounded = value;
                RaisePropertyChanged("IsRounded");
            }
        }


        [DataMember]
        public SatuanDTO SatuanPack
        {
            get { return _SatuanPack; }
            set
            {
                _SatuanPack = value;
                RaisePropertyChanged("SatuanPack");
            }
        }

        [DataMember]
        public CoaDTO CoaSales
        {
            get
            {
                return _CoaSales;
            }

            set
            {
                if (CoaSales == value) return;
                _CoaSales = value;
                RaisePropertyChanged("CoaSales");
            }
        }

        [DataMember]
        public CoaDTO CoaSalesReturn
        {
            get
            {
                return _CoaSalesReturn;
            }

            set
            {
                if (CoaSalesReturn == value) return;
                _CoaSalesReturn = value;
                RaisePropertyChanged("CoaSalesReturn");
            }
        }

        [DataMember]
        public CoaDTO CoaPurchaseReturn
        {
            get
            {
                return _CoaPurchaseReturn;
            }

            set
            {
                if (CoaPurchaseReturn == value) return;
                _CoaPurchaseReturn = value;
                RaisePropertyChanged("CoaPurchaseReturn");
            }
        }


        [DataMember]
        public CoaDTO CoaExpense
        {
            get
            {
                return _CoaExpense;
            }

            set
            {
                if (CoaExpense == value) return;
                _CoaExpense = value;
                RaisePropertyChanged("CoaExpense");
            }
        }

        [DataMember]
        public ItemDTO CoaInTransit
        {
            get
            {
                return _CoaInTransit;
            }

            set
            {
                if (CoaInTransit == value) return;
                _CoaInTransit = value;
                RaisePropertyChanged("CoaInTransit");
            }
        }


        [DataMember]
        public ItemDTO CoaUnbilled
        {
            get
            {
                return _CoaUnbilled;
            }

            set
            {
                if (CoaUnbilled == value) return;
                _CoaUnbilled = value;
                RaisePropertyChanged("CoaUnbilled");
            }
        }

        public int No
        {
            get { return _No; }
            set
            {
                _No = value;
                RaisePropertyChanged("No");
            }
        }

        public bool IsSelected
        {
            get { return _isSelected; }
            set
            {
                _isSelected = value;
                RaisePropertyChanged("IsSelected");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        protected void RaisePropertyChanged(string propertyname)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyname));
        }

        public override string ToString()
        {
            return this.ItemName;
        }
    }
}